setup code common to command line scripts
[lhc/web/wiklou.git] / maintenance / commandLine.inc
1 <?php
2 $wgCommandLineMode = true;
3
4 $sep = strchr( $include_path = ini_get( "include_path" ), ";" ) ? ";" : ":";
5 if ( $argv[1] ) {
6 $lang = $argv[1];
7 putenv( "wikilang=$lang");
8 $settingsFile = "/apache/htdocs/{$argv[1]}/w/LocalSettings.php";
9 $newpath = "/apache/common/php$sep";
10 } else {
11 $settingsFile = "../LocalSettings.php";
12 $newpath = "";
13 }
14
15 if ( ! is_readable( $settingsFile ) ) {
16 print "A copy of your installation's LocalSettings.php\n" .
17 "must exist in the source directory.\n";
18 exit();
19 }
20
21 ini_set( "include_path", "../includes$sep../languages$sep$newpath$IP$sep$include_path" );
22
23 $wgCommandLineMode = true;
24 $DP = "../includes";
25 include_once( $settingsFile );
26
27 include_once( "Setup.php" );
28 include_once( "./InitialiseMessages.inc" );
29 include_once( "../install-utils.inc" );
30 $wgTitle = Title::newFromText( "Rebuild messages script" );
31 $wgCommandLineMode = true;
32 set_time_limit(0);
33 ?>